package com.liu.repository;

import com.liu.domain.rule;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;

import java.util.Date;
import java.util.List;

/**
 * Created by liu on 17-10-15.
 */
public interface RuleRepository extends JpaRepository<rule,Integer> {

    @Query("select s from rule s  order by date desc" )
    public List<rule> findbydate();


    @Query("select s from rule s  where R_id = ?1 ")
    public List<rule> findbyroom(int R_id);                       //根据学生session room-id查询 违规

    @Query("select s from rule s  where TO_DAYS(s.date) = TO_DAYS(?1)" )
    public List<rule> findbytime(Date sj);                            //按日期搜索

}
